﻿#ifndef MAPPIC_H
#define MAPPIC_H

#include <QWidget>
#include <QLabel>
#include <QPushButton>
#include <QVBoxLayout>
#include <QEvent>
#include <QPainter>
#include <QPen>
#include <QPaintEvent>
#include <QMouseEvent>
#include <QApplication>
class MapPic : public QWidget
{
   Q_OBJECT
public:
   explicit MapPic(QWidget *parent = nullptr);
   enum  Type
   {
      None = 0,
      Amplification,
      Shrink,
      Lift,
      Right,
      Up,
      Down,
      Move
   };


private:
   QPixmap *pix;
   QLabel *label_map;
   Type action;               //动作(放大,缩小,移动...)
   int pixW;                  //图片宽
   int pixH;                  //图片高

   QRect Paint;               //绘画区域
   QLabel label;

   double ratio;                     //比例
   QPoint offset;                    //一次的图片偏移值
   QPoint Alloffset;                 //总偏移
   void paintEvent(QPaintEvent *event);
   bool event(QEvent *event);
   void wheelEvent(QWheelEvent *e);           //鼠标滑轮事件

signals:

public slots:
   void sltEnlargeMap();
   void sltNarrowMap();
};

#endif // MAPPIC_H
